added code that *may* fix the drift problem