fix extern shared memory bug

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