Fixing bug with sequences