fix rating calculation