updates to handle null metadata