quit on merge failure
added mat library for data scrubbing
refer to local mat library