Fixes

OK, this is yet another attempt for handling attachments extensions, it is meant to be done on upgrading and it should cover the old attachment system, meaning there shouldn't be any need for legacy code.

It also fixes some other small issues.