Add onReplaced event