Appears to fix #518, though I still don't really understand the prob