fixed race conditions related to hasWork