fix directory determination for single files. Fixes #262