Added a few debugging hints about bug.
Added (working!) locking to Python calls.