fix erase and trim