fix bug in table_to_ndarray