Fixed bug with edge creation