Abstract. The current version of a multi-phase transport (AMPT) model with string melting can reasonably describe the dN/dy yields, p T spectra and anisotropic flows of pions and kaons at low p T in heavy ion collisions at RHIC and LHC energies, although it failed to reproduce the dN/dy and p T spectra of baryons. In this work, we improve the quark coalescence mechanism in AMPT by removing the forced separate number conservations of mesons, baryons and antibaryons in each event. We find that the improved AMPT model can better describe the yields at midrapidity, the p T spectra and elliptic flow of low-p T baryons in comparison with the experimental data. Antiparticle-to-particle ratios of strange baryons are also significantly improved.