Various bugfixes, now valid syntax at least