fixed wrong response code on error