Fixes Issue #39

A bit simpler than sforster’s proposal in df68106df68106, but missing tests because could not get the line endings right on that file, so should use his