construct range arrays dynamically, fix data mismatch