bug fix: failed when the last char in the config is not a newline

And removing trailing whitespaces :)