Merge fixes from isra17's fork