patches to fix various problems