Make locking more safe:
- wrap locking algorithm into a SuperLock class that releases all locks in finalize
- release locks on exceptions