cleanup resources, devices impl and fixes