Improved cookie handling
Setting the right document url, also after submit