gpio: fixed many bugs.