make can_transform actually do something

Up to now these functions never waited for a transform.
The sleep loop's condition was broken and the sleep code itself
as well.