Fixed an off-by-one bug, bumped version to 1.26.

Merged bug fixes from forks, bumped version to 1.27