fix spawn loop