Fix timeout routine