Fix metadata total size calculation