fix sorting bug & update view count