strip metadata on replace

@petrjasek please ask if something is wrong or unclear