proposed solution to issue #31

It seems the start and end variables need to be set to 0-based.