Fix a lot of errors and add patches. Only few warnings left. No biggie