reapplying fix to #499, rolled back by #530
Merge pull request #545 from JohnnyEstilles/hotfix/reapplying-fix-499-rolled-back-by-530

reapplying fix to #499, rolled back by #530