Added nullptr checks.