Add url rewriting + some bugfix