fix #2171
fix #1900
some commented code to handle #2296
fix #2193