Added error handling functions on the server