Bugfix: return correct error code to client when going down