added sub id field and fixed trial type randomization