added proper error request handling