trying to fix index error