added PATH check, XDG paths set in a safer manner