Fixed most errors in LPGate.