Fix homeDirectory undefine bug