Fixed bug in error handling of server implementation