Oops, this was an oversight. I had some other problems and played around with different ways of passing the element to append. Turned out the problem was not related to append but some else and I just forgot to change this back.