fixed bugs in backpointer swapping and caching