Fix implementation of generic_type