fixing span order bug