Limited chunk size to 10K bytes
Fixed some bugs