#fix bug when using Mida refs ; added a test-case for it