fix a little bug in mode switching