Fixed various server-side bugs