fix matlab bug