bug fixes - stored procedure fixes for duty branches, and added set foreign key checks 0 when dynamically changing task template so that mode doesn't have to be set