Another round of fixes. Doesn't seem to address all issues.