Cleaned up a few error checks.