Fix #391.
Fix #309.