Fix problem with selecting directories and files.