fix google drive sync bug. refactor code

Fixed bug where sub folders of a google drive folder may not get synchronized properly. It was possible for them to get treated as files during sync due to an uninitialized variable. May be the reason for error reported in #78.