fix error when writing to a gpio pin for the first time