attempt to fix #1391, hold locks across fork() and initialize them in the child