Lots of small fixes, some merged from dropbox integration branch