Check name validity.
Reduce thread variables.
Update @device_last_run_count in at_run_end.