fixed sanity check bug