Marginally better error checking