moved caching default out of if statement