Fixed minor bugs in initialization.