Fix a bug in device.py around the type of keywords, add logging and