Umm. I moved the construct_nav_group() and it did not help. Any other ideas?
Hmm...I tried it and it seems to work. I did notice that you have "if (canmoderate)" which I wasn't sure was a typo or not (I think it should be if ($canmoderate)).
I actually moved the first "if" block last, so I'm not sure where the construct_nav_space() goes.