Cleanup of entity transfer system and crash-fixes.

Removed old unused code for transfer of entities.
Fixed crashes related to gamestate changes in certain orderings. This fixes #162 and #163.