Fixed a number of client and server side bugs.