use unsafe instead of directbuffer