added badvalue check
added badvalue check
added badvalue check