fix image cache not working if cache folder doesn't exist (issue 267)