Fixes #5650 (closed)
@humungusluver - I don't want this fix tied up with new features, so I'm just pushing it here; hope that's alright.