Added correct validation check to value_to_js