fix switching between primitives and clones
cleanup: split changeType function