Mode cache bug fix