fix user permissions and rewritings