Fixed bugs with merge vertices