Some cleanup in application desugar and primitive error reporting