fix bugs on path handling