Fixes

A few small fixes, see commits for details.