Fix #330.
Fix #329.
Fix #327.
Merge remote-tracking branch 'upstream/master'