fixing 3d code