Fixed type conversion errors in MarGrid2