Make signal handling reentrant, and fix race during initial load.