LPS-36977

Hey Tomas,

I'm just sending this to you so that you can take a look at the last commit which fixes the bug you had found (and the ones I found after fixing that one).

I'm going to merge these changes into the previous commits to make the pull easier to review for Brian.