Fix null metadata issue