Fixed a bug inherited from the MATLAB toolbox