Fix type correctness of mutex functions

Thanks to Toru Nishimura for this advice