add more tests for endsWith() and fix bug in implementation