add some rudimentary error-checking