Fixed JavaScript check