Fixed rating algorithm to not divide by 0