fixed #77
fixed #78 and #49