Merge pull request #566 from nomis52/master

Cleanup.
Fix some high impact defects.