fix the bug of failing to find boundary by specifying nchunks larget than 16, and some minor changes
minor changes