This appears to fix #323

I am very skeptical of this though