fixed #16 and #18