Fixing lock release in reparenting on error.
Adding optional logging for debugging.
Merge pull request #17 from youtube/reparent-fix

Fixing lock release in reparenting on error.