Change bad_ref_char() to return a boolean value