Fixes #1637
Apply Viktor's review :-)