Fixed server crash neatly

Cleaned up a little also