Various Fixes

See commits for details.