fix issues with cache and more cleanup