Fix several issues.