TITLE: Homotopic maps induce isomorphic pullbacks of a principal bundle. How functorial can this be?
QUESTION [5 upvotes]: More precisely, I'm trying to show that the groupoid $\mathscr{B}G(X)$ of principal $G$-bundles over $X$ and isomorphisms is equivalent to $\Pi_1(BG^X)$.  It seems like the right direction to try to construct my functor is $\Pi_1(BG^X) \rightarrow \mathscr{B}G(X)$, since given an actual $G$-bundle over $X$ I'm not sure how I should expect to make a choice of map $X\rightarrow BG$ (as opposed to just a choice of equivalence class up to homotopy).
So, to an object $(f:X\rightarrow BG)\in \Pi_1(BG^X)$ we of course associate $f^*EG\in \mathscr{B}G(X)$.  Then, given a morphism $([H]:X\times I \rightarrow BG)\in \Pi_1(BG^X)(f_0,f_1)$ (i.e. an equivalence class up to homotopy of paths from $f_0$ to $f_1$ in $BG^X$) We then use the lifting property, which can be done $G$-equivariantly, to get an isomorphism $f_0^*EG \rightarrow f_1^*EG$.
The problem is that unless I've got something a bit stronger this isn't going to be functorial: the composition of two homotopy-classes-of-paths in $BG^X$ won't necessarily give rise to the composite isomorphism.  It seems like what I want is a connection that'll tell me what "horizontal" means, but this is definitely not part of the data I'm given.
Bonus question: This doesn't work for topological groups (let $G$ be connected and take $X=pt$).  How can this be repaired -- is there a good alternative description of $\mathscr{B}G(X)$ in that case?

REPLY [2 votes]: If $G$ is discrete, $EG\to BG$ is a covering, so the lifting is unique. Since composition of liftings is always a lifting of composition, this implies functoriality.