Fix #2497/#2498 (/theme should return an error when loading fails)

It was actually doing that for old python version but not recent onces