Fixing loop in Keep state