writing of the SPS header