Fixed lock issues