fix#549 many fixes and new features