fix a bug in 3D surface rendering