fix error when wrong dir was specified