Fix session error and implement for 3d