Several fixes for header functionality