Fix ordering issue with persistent sessions