Apply some fixes from Carlos