Sleep properly rather than spinning CPU; fixes #454.

fixes #454