Fixed #1112

Did as proposed by @whit537 to fix #1112