Fixed deploy crash bug, improved empty template script