fix obtaining request object and logging error