Fix metadata management