Add tests and fix while%lwt