fixed bugs with wrong X/Y access in element mask in MM engine