[ticket/12597] Fix various refactoring mistakes

PHPBB3-12597