replace error response and add blank check