Fixed #1147

Thanks to grezg1