enlarge memory and add debug print