lock conditions implemented in the client side
various improvements mentioned in comments
fix test
fix compilation errors
Merge pull request #1762 from eminn/feature/client-conditions

lock conditions implemented in the client side