added some logic to fix the next button in the actions part of the header