fixed for ids out of range
Merge pull request #6 from chrissphinx/master

fixed for ids out of range