fixed #4 and #8