refs #14.  fixed some bugs