prevent "List index out of range error"
Merge pull request #32 from smcoll/patch-1

prevent "List index out of range error"