fix #308
fix #304
fix #300
fix #284