fixed code for recovery from closure or reload