mutex to protect app from crash