More patches and fixes