Fix off by one error in L() code

This was missed in tests because the in-place special case was not
tested. Thanks to David Neumann for the heads up.