Added unexpected exception handling to prevent mutex locking the process up