added hack to clear legend cache after context switch