call beforeAppend inside append