fixed problem with mutex bug causing a crash