fixed crash when dir does not exists