Fix for #247

This is for @aldanor, but would appreciate any review.  It is a pretty small change.