buggy implementation of locks