added missing stack pop on failure to build, otherwise gets stuck in directory