Some misc fixes

Apparently this is needed for compatibility with some clients.