A little more error-checking