Searching and Ranking:fixed division by zero bug