Fix NPE on some UT