corrected logic of name_and_value()