add extra error checking, add function names to err reports with similar output