check relation_metadata in condition

Fix #137

Credit to @hackeron