fix string compare to prevent null situation