code cleanup in plugin-safety