Slight changes for MATLAB+OpenCV workaround