Semplified caching and bug fix
Minor change