Fix #350.
Fix #349.
Merge remote-tracking branch 'upstream/master'