fix character range bug