Fix compiler errors when -Werror=declaration-after-statement is enabled