Fix bug 1084 - throw an exception if the wrong object is used for an edge