Fix device crash