Applying patch to 1.6.8 version, from Bruce Chang