Fix login NPE issue