fix for nil devices being destroyed