pick some patches from etobi's repository