Some fix in gpio waiting