improve metadata runtime cache
add metadata tests