Edited keyseq.c to clear existing flags before setting new values.