WL-2951 fix

Includes the code from [reference pull request 1](https://github.com/ox-it/wl-reference/pull/1).