Fix couple NPE issues.