Incorporate Mavericks fixes from arnemart.