necessary fixes to get BAGEL compiled.

I assume that begin(T) and end(T) are not implemented in a general enough way