Fixed JavaScript-induced null check error.