Fix insertion of records for hmt association with scope

Fix for #3548