fixed timing issue with timeout