Fixed some of the usual new-function bugs.