fixing bug with handling other status codes