finish collect function && fixed some bug