fixed #78 and #49