minor corrections to edge / mismatch finding code