Bug fix for prev/next