made some fixes to request handling