moved the header before the updating statement