Fix some bugs in the new optimized chaos