fixed a bug

IndexOf method of Array check strongly typed. I need loose type
checking, so I use a custom function to find the index of an element in
an array.