fix reopening bug