fix extern shared memory bug

- fix bug that type of extern shared memory can't defined by a template
- delete not used code