Fixed potential index related bug.