fixed NPE in mode