fix mess-up with locks