fixed an index error