added missing mutex locks on printf