fix overflow problem in comparasion function for diff buffer item