Add more error checks.