some cleanups in preparation for a new tarval_from_str interface