Fixed some bugs in collect and client