dont set factory attributes to nil
use a sequence to generate tag name
fix incorrect usage of sequence