Fixes for digest optimization