addToEnd not working