Simplify error checking