New tests.
Fix a stupid memory bug.
Fix some warnings.