fixed bugges, mutex works as expected, successful deadlock