trimmed the read line before comparing
(cherry picked from commit 91df73c)