restructured error query return to boolean