Couple of fixes for reading gpio pin value.

Without these, reading gpio values on the Raspberry Pi was erroring, or always returning true.