Added debugging prints

Also added missing mutex lock