fix bug with querying large data