[nadc_tools] fixed long standing bug in SELECT routine