fix rating func