fixed a bug in tab changing