fix #1244

I've written this on the train, so haven't even compiled it,.