First go at a fix for #1131 - can someone confirm this is the only change necessary?