Some refactoring and adding a workaround when using virtualbox.
The file caching now works even if time synchronization is not accurate on VMs.