Bug fixes in Matlab interface