Portability + function fixes.

This is enough to get the game to run properly without Postgres and on
other computers.