fix bug with last char in source mode