added a management command to debug the update_monitoring_states task
small fixes to get update_monitoring_states running