Make sure that selected index is integer

Make sure that selected index is integer. Index was sometimes float.