Fixing an error-catching bug