More robust path handling.