Fixed bug in getLastNonEmptyLine which was doing wrong check for non whitespace chars.