A bit more cleanup, fix of get_attribute and get_secondary for empty value checks