Cache deleting happens correctly and other fixes