change id back to index for Rating. The key of preparedData should be mid.