Repaired some broken code