Fixed a few bugs and allowed a victory without crashing.