changed fucntion scale_used_anywhere() according new signature of db->record_exists() that was changed from moodle v2.0