porting some fix from gdrive_storage branch