added debug output to explore behavior of python locks in event functions