Applying fixes from master