set the response code correctly