Handle tablenames with spaces correctly