Fix autoloadDirectory method if $path is null or empty