Prevent creation of ways with duplicate nodes

Related to #1249