Fixed logic error in gpio