fix the bug that memory is not initiaized with 0