Fixed use of append(). It needs to reassign the container after append in case of reallocation.