Fixed some bugs

fixed #58
fixed #59