Fix destruction of favorites when media is deleted

I'm not sure this will work perfectly, but it should.