Fixed some pretty serious bugs in append and prepend