Works after reset

This refactoring sets pointers to NULL at the beginning. The Device
works after reset.