Major bug in mat.train which quietly breaks whole analysis fixed