Krystianp: should better handle restarts