convert output index to int. Solves errors caused by unicode.