Fix #304.
Fix #305.
Merge remote-tracking branch 'upstream/master'