version with locks