Fix merge state detection