Bunch of fixes which I cant remmember what it does.