mod_base: make filter replace more robust against 'undefined' inputs.