fixed NPE in mode
fixed NPE in mode