Fix startup bugs.