Fixed impersonation on ajax calls and cancelling impersonation