Add afork to mitigate issues of mixing threading and forking