More fixes, ready for intermediate language generation