fixed sendError usage