removed unused class
added assert to ensure types[index] is not null