@cleargif fix for #319

The other branch was deleted, but this retains @cleargif 's fix.