bugfix for mutiple device in context segfault