fixed bugs and added initialize templates script