correctly cast string to int