Fix some gamelogic/game issues discovered by coverity.