fixing chain-generation