Added OptimisticLockWithTimestamp tests and fixed a bug