Bug fix for block optimize