adds valid check to numeric constructor