Fixes memory error in metadata functions.