Various fixes.

Remove checkout duplication, use isUploadAllowed(),
remove dir_size function.