Applied patch from @bafu