lock simplification and bash 4.1 compat