bugfixes and adding the enableCaching option