Fix builder reset and unused var removal