Fixed a bug in parse_device function.