Fix flag switch when hitting SPACE key