check for empty before disposing