fixed issue #1622. Thanks @kyleflanagan for reporting it