make metadata optional in responses

PR for issue #231.