fixes #155 by using setTimeout(fn, 0)