Refs #4 Fixed some bugs