base functions for gpio working
fix some bugs