fixed url rewriting and other things