Reverted to sessions and patched code