Fix bug in cutting of long edges in build process