modified check_arrays to handle multiple sparse formats