Bug fixes for load template handler