replacing message.fail()) with sendError