fix character counting