fixed some issues with spawn