update cursor override utility

this version is safer than relying on balanced pushes and pops