lock related changes...one of the test case still fails sometime, more commits on this would follow eventually