converted internal_to_elem() as well

internal_to_elem() function also has been converted
to the order-preserving dictionary version.