Fixed the wrong comment count in issue page

Fixed the wrong comment count in issue page. Some code cleanup