Remove all workarounds for the agj non structured output, and fixes some minor bugs