Lock objects' hash keys in constructors