Fix wrong mode when creating cache directories