Fix infinite recursion caused by kpm pack to a dir in project dir

parent #454