Extracted from #75. I know what the problem is, not sure what the solution could be though 🙂 Thoughts welcome!