Fix an off by one mistake, Handle max byte encounters, and return errors instead of panics. Fixes #39.