Fixes issue #2228

Previous pull request that fixed this was closed due to me stuffing up ;-)