Created by: stansv
Please review, I don't like this solution but it seems to work.
Fixes https://github.com/OptimalBits/bull/issues/1340.