fixes corner cases like symlinks and zero-size files