Fixed 3d bugs