Fix typo
Add support for failed read
Use bitwise for indexOf test and replace old jQuery.inArray