Fix IndexError (Issue #9)