Added packet writing in spawn