Fixed some major bugs.