simplify and fix target_type_from_site