Used substr_compare instead of substr when we don't care about result