Fix bugs in game context api