Fix setting scope when formatting rows as header

please review and merge! :)