Fixes #1153. Fixes #1149. Fixes #1146.