improvements to $PATH handling