fix choose invalid text bug, by removing the white spaces