Fixed race condition in chosen directive