fixed when using --directory with '.' or '..'