fix bug in edge drawing code