manually merged pr #1029 by @baslr