[ref] Added some null checks.