Corrected problem with getCompleteLastCharacter

Resolved a problem with infinite loop when character is at the end of
file