fixed bug in getting gpio value, improved test