fixed serious issue with the spawn logic