Made control more reliable (stuck setTimeout outside the query)