Fixed NullPointerExceptions and other errors in Server class.