added lastidx to the fd struct
started working on send_chunk