fix context handling for ajax requests