fixed bug where a fresh appended div was undefined