replaced $type with the correct $t.