added debugging prints. Too lazy to use a real logger.
minor fix (removed redundant unlock call)