fixed indexing bug to subtract 1