properly pass dir argument