some fixes with locks