Add more tests and expose bugs in metadata and rasm