rex_replace_dynamic_contents: fixed return value, closes #185