Fix potential NPE cause