Enabled caching and fixed race conditions