Hi Keith,
I can't tell why Frame sometimes locks up, as I don't know what your applyNewPgfFmt function looks like. I would keep displaying on until the code is perfected and well-tested, then use the debug mode to step through until it hits the spot where Frame locks up. You can also write debug messages to either a text file or the console, simply by using the function Console( "message" );
Good luck
Jang