add LMS tests and fix bugs surfaced from that