Fixed race condition in cljs reduce function