fix spawning bug