fix problem with wrong REWRITE_BASE