better handling of dir tests