fix bug of when in end of line