rudimentary error checking