MDL-53451 competency: Hook for scale_used used undefined variable