playerglobals bugfixes

This set of patches gets us to a state where the reftests run through and don't have any obvious problems. I'm not yet sure if the results are all as expected, though