Fixed unitspawn crashing