Issue #647, fix newline handling edge case.

Doesn't this mean that x = 0 is impossible after wrapping?