fix #5 (off-by-one error)
Merge pull request #7 from davharris/master

fix NA in Issue #5