Fix auto close when no element