Fix graph mode changing problem