Adds test coverage, a little late.
Fix null state bugs.