fix race condition on ajax directions