fix which for relative paths with directories