fix #666

also #667