Fixed some initialization bugs.