add rudimentary error message handling