First bunch of fixes