Fix bug in inArray function