correct empty ptag search and build-impl fix