Fixed handling of symlinks