Fixed id2generator to work with older versions of matlab