made -r option safer by trimming to path head
moved safety checks before -r, added messages on failure
changed output message