Fixing bug in transfer value optimizations