lpc: improve performance, use proper .wait() condition