remove settimeout hack, keep a count & call a function instead