add error checks to subprogram evaluation