Prevents vertices being duplicated

Fixes #3897