Low-level helper for changing types.