[DF-185] Fixed cast_if_equal class to make it work correctly.