Correctly trigger reset/cleanup events.

Also restoring the old behavior with heart_beat() etc.