First batch of bug and crash fixes

Fixed a few bugs and at least one source of segfault, where the increment code attempted to read level data of a non-existant level.