Fix some type instability in read_array