Fixed the handling of hard-linked symlinks and devices.