Attempt to fix potential bug in some MATLAB versions