Fix #543
fix #659