fix last thread->references changes
simplify heatmap reply count code
fix patch_store finally