small fix for an index error