added check for empty work dir