Replace indexOf by inArray to workaround IE < 9 incompatibility