fixed bug in rewrite param building