Fixed the header buttons selection logic.