Revise error checking