object.c: clear replace map before freeing it