optimize and fix file qualities storage