LPS-49930 Fix tests and improve performance