This is a correction to a previous pull request. This fixes a bug that accidentally assigns the class 'undefined' if the original option had no classes.