Fixed another leak that occured when onend() wasn't defined.