XSRF and some small fixes