More cleanups and fixes to work on Ubuntu