fixed foreign key constraint in rating