Fixed a large number of issues.