Fixed a bug when run at MATLAB 2008a