Added some debugging code to determine the cause of the "open cursors"
problem