Apply fixes from master