Fix #605, fix #255, fix #101