rename $def into $extend