check first if request and response are indeed objects

fixes race condition
Merge branch 'fix_print_response'