Fix SpawnCommand and SetSpawnCommand

Cleaned up code