fix bug when no records, the from should be 0 not 1