fixed the double opening bug