add some casts to support a change in the getOrInsertFunction interface