fix bug in shm.c