Lower sgbuild memory requirements and fix edge counting