General fixes

See commits.