fix a error for not initializing when the path is dir
adjust the option for customizability use