Second bunch of fixes