Merged fix from brandstaetter pull request