fix bugs caused by r144949 when MALLOC_DEBUG is defined