fix bugs on sort event