Fix for chunkrecord to deal with long sequences.  Other bug fixes and improvements.