Fix failing tests

Also use constant for @metadata and [@metadata]