Patches for Mavericks bugs.

FIXME: which issue is fixed by the first patch?