Fixed a number of issues.