Various fixes

See commit details