set internal gap flag correctly