a bit of error handling