Fix wrong API usage.

NPE caused by the fact that getCurrentState was queried for run stared
when the work was actually done.