fix persitant offheap issues, added tests, fixed nonshared mode.