Fixed indexing bounds issue #54