fixing error 500 on impersonation