Fix some more error checks and error output.