Fixed metadata() mixin, added unit tests