Fix server exception handling and error response