Fixed #264

* Upon deleting a template, the connected blocks will be deleted as well
Fixed use statement order
Merge pull request #267 from frmwrk123/fix/264

Fixed #264