add mutex to message handler