Issues 1349, 1411, and 1348

I started with the same branch as the other pr, so that commit is in here as well (issue 1400).