Fix #406 fix #407
Fix #361
Fix #402