Fix incorrect Mat address reconstruction on 64-bit platforms

This fixes random failures in Java wrappers.