trying to fix index errors