fix some bugs

The memory don't alloc bug that leads to a faild in real machine.
Fix code signing problem.