An inversion algorithm for polynomial maps