fixing bugs of the header and adding a reset