Wrapped session re-genration in a conditional (getting a 500).