More gen function port, had a problem with type-punning + object slicing.