Improved checks where substr_compare is used, replaced more substr + comapre cases with substr_compare