improved content replacement, fixed delete