clean up, bugfixes, and general improvement for shm_open/shm_unlink