manually applying fix for #207 to production branch