Some attempts to fix problems with BigInteger memory allocation