make sure all memory in init before use
Merge pull request #19 from judajake/fix_unit_memory

make sure all memory in init before use