A bunch of fixes to ensure valid sbml