Fix crash due to undefined 'timeout' variable; fix cache timeout calculation
Merge pull request #1 from amitburst/fix-timeout-bug

Fix crash due to undefined 'timeout' variable; fix cache timeout calculation