Fixing an issue with statement caching