Fixes issue #2 IndexError: list index out of range