Fix #377.
Fix #378.
Fix #379.
Merge remote-tracking branch 'upstream/master'