Added type checks to all_equal