added error handling for clear gpio