Add Ubuntu fixes and fix build on i386