Define lastRequest as local variable instead of global

Fixes an exception that gets raised in newer browsers