Added error check for chain append process