Minor bug fixes. (Including make template delete button work)