Fix bugs with updateFolders

It should now be updating folders correctly.