revise last error checking