added js value range check