Templates: Fix EOF handling for select in table