fixing behavior when passing a non-directory to --directory