Fix NPE issue