fix endsWith bug