complete error checking in example