TimePerid is used for sleep interval instead of constant number (fixes #525)