Some small fixes

See comments for details