Bugfix: Really fix the crash in bm.c, do memory checking after each allocation, corre...