Fix bug when writing to sysfs file and typo