dirty fix, works on non-error lpt, needs improving