fixed #65 and #2067.