Fix mutex locks, I think