Fix successor function