fixed bug with descending sequences
fixed bug with descending sequences