fixed response code being sent twice