Fix bug where last char is truncated on firefox