Fix a possible memory leak
Fix a nasty bug
Add some parse fail tests (and fix some of them)