try to fix JS problem with a callback instead of a timeout