fix multi-byte bug in previous.

Use the right offset when working out if we should mask off the sign bit.
Add more tests that would have caught this case.