Fixed stat method, checks dir if its a new file.

Fixed needs_root() so if the file doesn't exist
already, it will stat() the directory instead.
It was returning false positives before.