Prevent duplicate consecutive nodes (#1296)