Fix critical functions in shared_mem