This should fix the bug that @ausil pointed out here.
@ralph Could you rebase this, and I'll merge it?
Pull-Request has been rebased
@mikeb, rebased and done.
Pull-Request has been merged by mikeb