fix #667 fix #664