fix bug with select  hist table