Fixed some really obvious problems. Not sure how these managed to
not cause massive problems sooner.