handle sprite with invalid id
improve map performance