moving the sanity check to a better location