some fixes in rmg