Added sanity checks to matlab loader