Merge pull request #84 from dterweij/6.1.x

Project Issue #1095 #804 #982. XCache bugfixes and code cleanups.