Added forgotten table for id templates and some error handling