Added sanity check of values before returning them from the constructor.