Fixed some Matlab errors