Fix Pattern code