Fixed some use of string.startswith() and endswith()