fix respond_error function to return byte string