Fixed a server crash
Fix more server crashes and clean up