Minor improvement on path building