Make Array.prototype.endsWith more robustier