Bugfix: id is null

- check on connected Device if header is set
Add function to log errors and changes