improved seq extraction
fixed debug