fix
fixed script when index does not exist