Fix for index corruption in some cases

See changelog.txt for detailed changes