[IMP] Some refactoring, check config folder permission