fixed memory leak, also copy mapoffsets in chain_set_ledcount
fixed memory leak