Applying patch from @avsej