Several fixes and improvements

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | ---
| Fixed tickets | #1206
| Refs tickets  | #1140
| License       | MIT
| Doc PR        | ---