replaces Array.apply with Array.prototype.slice