fixed bug in rewrite rule